using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AnQinFrameWorkAPI.Common.Enum;

namespace AnQinFrameWorkAPI.Entity.Finance.Entity;

/// <summary>
///     账目消费明细表
/// </summary>
[Table("FinanceDetail")]
public class FinanceDetailModel
{
    #region 字段

    /// <summary>
    ///     id
    /// </summary>
    [Key]
    [MaxLength(36)]
    public Guid Id { get; set; }

    /// <summary>
    ///     用户id
    /// </summary>
    [MaxLength(36)]
    public Guid UserId { get; set; }

    /// <summary>
    ///     分类id
    /// </summary>
    [MaxLength(36)]
    public Guid FinanceCategoryId { get; set; }

    /// <summary>
    ///     账户id
    /// </summary>
    [MaxLength(36)]
    public Guid FinanceAccountId { get; set; }

    /// <summary>
    ///     消费名称
    /// </summary>
    [MaxLength(200)]
    public string Name { get; set; }

    /// <summary>
    ///     金额
    /// </summary>
    [Column(TypeName = "decimal(18, 2)")]
    public decimal Amount { get; set; }

    /// <summary>
    ///     类型（枚举：支出或者收入）
    /// </summary>
    public FinanceEnum.FinanceDetailTypeEnum Type { get; set; }

    /// <summary>
    ///     收支时间
    /// </summary>
    public DateTime TransactionTime { get; set; }

    /// <summary>
    ///     备注
    /// </summary>
    [MaxLength(500)]
    public string? Remark { get; set; }

    /// <summary>
    ///     附件
    /// </summary>
    [MaxLength(500)]
    public string? Attachment { get; set; }

    /// <summary>
    ///     创建时间
    /// </summary>
    public DateTime CreateTime { get; set; }

    #endregion

    #region 关联

    /// <summary>
    ///     财务用户
    /// </summary>
    public virtual FinanceUserModel FinanceUser { get; set; }

    /// <summary>
    ///     财务分类
    /// </summary>
    public virtual FinanceCategoryModel FinanceCategory { get; set; }

    /// <summary>
    ///     财务账户
    /// </summary>
    public virtual FinanceUserAccount FinanceAccount { get; set; }

    #endregion
}